#include <sys/types.h>
#include <signal.h>
#include <string>
#include <iostream>
#include <cstdlib>
#include <cstdio>

using namespace std;

// 被static修饰的函数的作用域为该进程，不会被其他文件extern
static void usage(const string& process_name) {
    cout << endl 
    << "usage is " << process_name << " " << "signal " << "pid" << endl;
    exit(0);
}

int main(int argc, char** argv) {
    if (argc != 3) {
        usage(argv[0]);
    }

    int signal = atoi(argv[1]);
    int pid = atoi(argv[2]);

    int ret = kill(pid, signal);
    if (ret != 0) {
        perror("kill");
    }
    return 0;
}